#include <vector>

using namespace std;

class Solution
{
public:
    vector<int> exchange(vector<int> &nums)
    {
        vector<int> ret;
        ret.resize(nums.size());
        int left = 0, right = nums.size() - 1;
        int a = 0;
        for (auto e : nums)
        {
            if (e % 2)
            {
                ret[left] = e;
                ++left;
            }
            else
            {
                ret[right] = e;
                --right;
            }
            ++a;
        }
        return ret;
    }
};
